import path from "path"
import resret from "../../commonPort/resret"
import { readFlie} from "../../../../fs_file包封装/node_modules/fs_file"
export default function sort(req, res) { //登录验证
    let crr = JSON.parse(readFlie(path.join(__dirname, "../json/json.json")))
    let {
        typehade,
        typeend
    } = JSON.parse(req.buf)
    let list = []
    crr.forEach(item => {
        if (item["class"] === typehade || typehade === "全部") {
            item["list"].forEach(key => {
                if (key["name"].indexOf(typeend) != -1 || typeend === "") {
                    list.push(key)
                }
            })
        }
    })
    resret({
        res,
        text: JSON.stringify(list)
    })
    return true;
}